//814

  Definition for a binary tree node.
  public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
      TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
          this.left = left;
          this.right = right;
      }
  }
 
class Solution {
    public TreeNode pruneTree(TreeNode root) {
        if (!fun(root)) {
            return null;
        }
        return root;
    }

    public boolean fun(TreeNode root) {
        if (root == null) {
            return false;
        }
        if (!fun(root.left)) {
            root.left = null;
        }
        if (!fun(root.right)) {
            root.right = null;
        }
        if (root.left == root.right && root.left == null) {
            return root.val == 0  false  true;
        }
        return true;
    }

}